﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Interfaces.Add_Interfaces;
using Interfaces.Inherited_Interfaces;
using Views.Status_Views;
using Presenters.General_Presenters;
using Presenters.Add_Presenters;

namespace Views.Add_Views
{
    public partial class ClientAddView : Form, IClientAddView
    {
        ClientAddPresenter presenter = null;

        public ClientAddView()
        {
            InitializeComponent();
            presenter = new ClientAddPresenter(this);
        }

        void ICloseable.Close()
        {
            this.Close();
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            presenter.ExitApp();
        }

        T IView.ReturnView<T>()
        {
            return (T)((object)this);
        }

        void IError.ShowError()
        {
            presenter.ShowError(new ErrorView());
        }

        void ISuccess.ShowSuccess()
        {
            presenter.ShowSuccess(new SuccessView());
        }

        private void button1_Click(object sender, EventArgs e)
        {
            presenter.Save();
        }

        DateTime IClientAddView.dateInsert
        {
            get
            {
                return DateTime.Now;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        string IClientAddView.descriptionClient
        {
            get
            {
                return richTextBox1.Text;
            }
            set
            {
                richTextBox1.Text = value as string;
            }
        }

        string IClientAddView.email
        {
            get
            {
                return email.Text;
            }
            set
            {
                email.Text = value as string;
            }
        }

        int IClientAddView.idClient
        {
            get
            {
                return 0;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        string IClientAddView.inventedName
        {
            get
            {
                return inventedName.Text;
            }
            set
            {
                inventedName.Text = value as string;
            }
        }

        bool IClientAddView.isProtected
        {
            get
            {
                return isProtected.Checked;
            }
            set
            {
                isProtected.Checked = value;
            }
        }

        string IClientAddView.nameClient
        {
            get
            {
                return nameClient.Text;
            }
            set
            {
                nameClient.Text = value as string;
            }
        }

        string IClientAddView.nameCorporation
        {
            get
            {
                return nameCorporation.Text;
            }
            set
            {
                nameCorporation.Text = value as string;
            }
        }

        string IClientAddView.phoneNumber
        {
            get
            {
                return phoneNumber.Text;
            }
            set
            {
                phoneNumber.Text = value as string;
            }
        }

        string IClientAddView.surnameClient
        {
            get
            {
                return surnameClient.Text;
            }
            set
            {
                surnameClient.Text = value as string;
            }
        }


        void INotifiControl.BadFormat(string nameControl)
        {
            throw new NotImplementedException();
        }


        void INotifiControl.ResetNotifi()
        {
            throw new NotImplementedException();
        }
    }
}
